﻿FROM nginx:1.25.5-alpine AS base
WORKDIR /usr/share/nginx/html
EXPOSE 80
 
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS publish
WORKDIR /src
COPY . .
RUN dotnet publish "Stickerwall.WebApp.csproj" -c Release -o /app/publish
 
FROM base as final
WORKDIR /usr/share/nginx/html
COPY --from=publish /src/nginx.conf /etc/nginx/nginx.conf
COPY --from=publish /app/publish/wwwroot .
COPY subst_env.sh /usr/share/nginx/html/subst_env.sh
RUN chmod +x subst_env.sh
CMD /usr/share/nginx/html/subst_env.sh && nginx -g "daemon off;"